package com.mlethe.android.demo.seattable.api;

import com.mlethe.android.demo.seattable.entity.CineSeat;
import com.mlethe.android.demo.seattable.entity.Hall;
import com.mlethe.android.demo.seattable.entity.Obj;
import com.mlethe.android.demo.seattable.entity.Result;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;

public interface ServiceApi {

    /**
     * 获取放映计划列表
     * @param cinemaKey
     * @return
     */
    @POST("pro_endpoint/cinema/cinemaPlays")
    @FormUrlEncoded()
    Observable<Result<Obj<List<Hall>>>> cinemaPlays(@Field("cinemaKey") String cinemaKey);

    /**
     * 获取某（几）个场次信息
     * @param cinemaKey
     * @return
     */
    @POST("pro_endpoint/cinema/cinemaPlayInfo")
    @FormUrlEncoded()
    Observable<Result<Obj<List<Hall>>>> cinemaPlayInfo(@Field("cinemaKey") String cinemaKey);

    /**
     * 获取某场次座位状态
     * @param cinemaKey
     * @return
     */
    @POST("pro_endpoint/cinema/cinemaPlaySeatStatus")
    @FormUrlEncoded()
    Observable<Result<Obj<List<CineSeat>>>> cinemaPlaySeatStatus(@Field("cinemaKey") String cinemaKey);

    @POST("pro_endpoint/cinema/cinemaHallSeats")
    @FormUrlEncoded()
    Observable<Result<Obj<List<CineSeat>>>> getSeatsRx(@Field("cinemaKey") String cinemaKey);

    @POST("pro_endpoint/cinema/cinemaHallSeats")
    @FormUrlEncoded()
    Call<Result<Obj<List<CineSeat>>>> getSeats(@Field("cinemaKey") String cinemaKey);

    @POST("pro_endpoint/cinema/cinemaHallSeats")
    @Headers({"Content-Type:multipart/form-data"})
    @FormUrlEncoded()
    Call<Result<Obj<List<CineSeat>>>> getSeatsFormData(@FieldMap Map<String, String> params);

    @POST("api/base/search")
    @Headers({"Content-Type:multipart/form-data"})
    @FormUrlEncoded
    Call<Object> search(@Field("condition") String condition, @Field("page") int page);
}
